package sim.app.panicspreading;

import java.awt.Color;
import java.awt.Graphics2D;

import sim.engine.SimState;
import sim.engine.Steppable;
import sim.portrayal.DrawInfo2D;
import sim.portrayal.simple.OvalPortrayal2D;
import sim.util.Int2D;

public class Victim extends OvalPortrayal2D implements Steppable {

	private static final long serialVersionUID = 3676850848049449617L;

	private double health;
	Color[] hColor = new Color[11];
	
	public Victim() {
		health = 1;
		int mclr = 229;
		int csz = hColor.length - 1;
		for(int i = 0; i < csz; i++) {
			hColor[i] = new Color(mclr/csz * i, mclr - mclr/csz*i, 0);
		}
	}
	
	@Override
	public void step(SimState state) {
		final PanicSpreading sim = (PanicSpreading) state;
		Int2D location = sim.agentGrid.getObjectLocation(this);
		int x = location.x;
        int y = location.y;
        
        if(health == 0) return;
        
        
	}
	
	public final void draw(Object object, Graphics2D graphics, DrawInfo2D info) {
		graphics.setColor(hColor[(int)health*10]);
		
		int x = (int)(info.draw.x - info.draw.width / 2.0);
        int y = (int)(info.draw.y - info.draw.height / 2.0);
        int width = (int)(info.draw.width);
        int height = (int)(info.draw.height);
        graphics.fillOval(x,y,width, height);
	}

}
